package com.cinema.data;

import java.io.Serializable;
import java.util.Date;

public class Schedule implements Cloneable, Serializable{

	private static final long serialVersionUID = 1L;
	private Date[] date; 
	private boolean[][] seat;
	private int size;
	
	public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
	
	public Schedule(int size){
		this.setSize(size);
		date = new Date[size];
		seat = new boolean[size][Common.MAXSEAT];
		for(int i = 0; i < size; i++)
			for(int j = 0; j < Common.MAXSEAT; j++)
				seat[i][j] = false;
	}
	
	public void setDate(int pos, Date date){
		this.date[pos] = date;
	}
	
	public void setDate(Date[] date){
		this.date = date;
	}
	
	public void setSeat(int pos, int seatno){
		this.seat[pos][seatno] = true;
	}
	
	public Date[] getDateList(){
		return date;
	}
	
	public boolean[] getSeat(int pos){
		return seat[pos];
	}
	
	public int getPos(Date in){
		for(int i = 0; i < this.size; i++)
			if(this.date[i].equals(in))
				return i;
			else continue;
		return -1;
	}
	
	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}
}